package com.gg.registration.order.mqListener;

import com.gg.registration.order.service.OrderService;
import com.gg.registration.rabbitmq.constant.MQConstant;
import com.gg.registration.rabbitmq.service.RabbitService;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * 这个是用于监听定时任务的监听器
 * 每天早上八点都会接收到信息
 * Author：  chenjunjia
 * Date：    2022/4/29 17:35
 * WeChat：  China_JoJo_
 */
@Component
public class OrderListener {

    @Resource
    private OrderService orderService;

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = MQConstant.QUEUE_TASK_8, durable = "true"),
            exchange = @Exchange(value = MQConstant.EXCHANGE_DIRECT_TASK),
            key = {MQConstant.ROUTING_TASK_8}
    ))
    public void patientTips(Message message, Channel channel) throws IOException {
        orderService.patientTips();
    }

}
